package com.yequan.spring.bean.definition;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * Bean垃圾回收
 *
 * @author : Administrator
 * @date : 2020/4/6
 */
public class BeanGarbageCollectionDemo {

    public static void main(String[] args) throws InterruptedException {
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();
        applicationContext.register(BeanInitializationDemo.class);
        applicationContext.refresh();
        applicationContext.close();
        System.out.println("Spring 应用上下文已关闭...");

        Thread.sleep(5000L);
        //强制触发gc
        System.gc();
        Thread.sleep(5000L);

    }

}
